// To parse this JSON data, do
//
//     final topicDetailModel = topicDetailModelFromJson(jsonString);

import 'dart:convert';

TopicDetailModel topicDetailModelFromJson(String str) => TopicDetailModel.fromJson(json.decode(str));

String topicDetailModelToJson(TopicDetailModel data) => json.encode(data.toJson());


class TopicListModel {
  List<TopicDetailModel> list;
  TopicListModel(this.list);

  factory TopicListModel.fromJson(List<dynamic> list) {
    // 调用自身构造方法传值并返回
    return TopicListModel(
      list.map((listItem) => TopicDetailModel.fromJson(listItem)).toList(),
    );
  }
}

class TopicDetailModel {
    TopicDetailModel({
        this.id,
        this.name,
        this.publishTimes,
        this.coverUrl,
        this.createUserId,
        this.lastUpdateUserId,
        this.artistId,
        this.createTime,
        this.updateTime,
        this.createUserName,
        this.lastUpdateUserName,
        this.momentCount,
        this.userCount,
    });

    int id;
    String name;
    int publishTimes;
    String coverUrl;
    int createUserId;
    int lastUpdateUserId;
    int artistId;
    DateTime createTime;
    DateTime updateTime;
    String createUserName;
    String lastUpdateUserName;
    int momentCount;
    dynamic userCount;

    factory TopicDetailModel.fromJson(Map<String, dynamic> json) => TopicDetailModel(
        id: json["id"],
        name: json["name"],
        publishTimes: json["publishTimes"],
        coverUrl: json["coverUrl"],
        createUserId: json["createUserId"],
        lastUpdateUserId: json["lastUpdateUserId"],
        artistId: json["artistId"],
        createTime: DateTime.parse(json["createTime"]),
        updateTime: DateTime.parse(json["updateTime"]),
        createUserName: json["createUserName"],
        lastUpdateUserName: json["lastUpdateUserName"],
        momentCount: json["momentCount"],
        userCount: json["userCount"],
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "name": name,
        "publishTimes": publishTimes,
        "coverUrl": coverUrl,
        "createUserId": createUserId,
        "lastUpdateUserId": lastUpdateUserId,
        "artistId": artistId,
        "createTime": createTime.toIso8601String(),
        "updateTime": updateTime.toIso8601String(),
        "createUserName": createUserName,
        "lastUpdateUserName": lastUpdateUserName,
        "momentCount": momentCount,
        "userCount": userCount,
    };
}
